﻿using JzSport.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JzSport.Api.Params
{
    class GetActivityListByCategoryParams : IActionParams
    {
        public string Filter { get; set; }
        public string City { get; set; }
        public double Longitude { get; set; }
        public double Latitude { get; set; }
        public string CategoryCode { get; set; }
        public int TimeCondition { get; set; }
        public int DistanceCondition { get; set; }
        public int PersonCountCondition { get; set; }
        public int Page { get; set; }

        public void ParseQueryString(System.Web.HttpRequest request)
        {
            this.Filter = request.QueryString["op:filter"];
            this.City = request.QueryString["op:city"];
            this.Longitude = Convert.ToDouble(request.QueryString["op:longitude"]);
            this.Latitude = Convert.ToDouble(request.QueryString["op:latitude"]);
            this.CategoryCode = request.QueryString["op:categorycode"];
            this.TimeCondition = Convert.ToInt32(request.QueryString["op:timecondition"]);
            this.DistanceCondition = Convert.ToInt32(request.QueryString["op:distancecondition"]);
            this.PersonCountCondition = Convert.ToInt32(request.QueryString["op:personcountcondition"]);
            this.Page = Convert.ToInt32(request.QueryString["op:page"]);
        }

        public void ParseForm(System.Web.HttpRequest request)
        {
            this.Filter = request.Form["op:filter"];
            this.City = request.Form["op:city"];
            this.Longitude = Convert.ToDouble(request.Form["op:longitude"]);
            this.Latitude = Convert.ToDouble(request.Form["op:latitude"]);
            this.CategoryCode = request.Form["op:categorycode"];
            this.TimeCondition = Convert.ToInt32(request.Form["op:timecondition"]);
            this.DistanceCondition = Convert.ToInt32(request.Form["op:distancecondition"]);
            this.PersonCountCondition = Convert.ToInt32(request.Form["op:personcountcondition"]);
            this.Page = Convert.ToInt32(request.Form["op:page"]);
        }
    }
}
